<?php

    #-------------------------------------------------------------#
	# This file is part of the Tekuna MVC Microframework for PHP. #
	# (c) 2009 Niels Jäckel <niels.jaeckel@tekuna.org>            #
	# Please visit http://tekuna.org/ for more information.       #
	#                                                             #
	# This software is licensed under the MIT License. Please     #
	# view the LICENSE file for the full text of this license.    #
    #-------------------------------------------------------------#


	Tekuna :: load('org.tekuna.core.filter.data.URLCharsFilter');


	/**
	 * This filter extends the URLCharsFilter by ensuring a beginning with a slash.
	 */

	class TekunaActionFilter extends URLCharsFilter {


		/**
		 * Removes all characters that are no valid URL characters
		 * and prepends a slash if this is not still there.
		 *
		 * @param mixex $mInput
		 * @return string
		 */

		public function filter($mInput) {

			$mInput = parent :: filter($mInput);

			// ensure minimal length
			if (strlen($mInput) == 0) {

				$mInput = '/';
			}

			// prepend slash if not still there
			if ($mInput{0} != '/') {

				$mInput = '/'. $mInput;
			}

			return $mInput;
		}
	}
